package io.renren.modules.mark.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.renren.modules.mark.entity.MarkItemEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 
 * 
 * @author 
 * @date
 */
@Mapper
public interface MarkItemDao extends BaseMapper<MarkItemEntity> {

//    @Select("select max(item_id) id from mark_item where user_id = ${userId} and dataset_id = ${datasetId} and item_id < ${itemId} " +
//            "union all " +
//            "select min(item_id) id from mark_item where user_id = ${userId} and dataset_id = ${datasetId} and item_id > ${itemId}")
    List<String> getPreAndNext(Map map);


    @Select("select su.username,temp.count from" +
            " (select user_id,count(1) count from mark_item where update_time between #{startTime} and #{endTime}" +
            " and state between 2 and 4 group by user_id order by count desc limit 10) as temp,sys_user su " +
            " where su.user_id = temp.user_id")
    List<Map<String,String>> selectRanking(@Param("startTime")String startTime,@Param("endTime")String endTime);
	
}
